package crudfx.container;
import crudfx.interop.*;
import crudfx.data.*;
import javax.swing.*;
import javax.swing.border.*;
import javafx.scene.paint.*;
/**
 * @profile desktop
 * @author Sergey Surikov
 */
public class ScrollPanel extends UIComponent {
    protected var jScrollPane:JScrollPane;
    public var content:UIComponent on replace o=n{
        if(o!=null)jScrollPane.getViewport().remove(o.getJComponent());
        if(n!=null){
            jScrollPane.getViewport().add(n.getJComponent());
            }
        jScrollPane.validate();
        };
    init{
        jScrollPane=new JScrollPane();
        jScrollPane.getViewport().setOpaque(false);
        jScrollPane.setOpaque(false);
        jScrollPane.getViewport().add(content.getJComponent());
        }
    override public function getJComponent():JComponent{
        return jScrollPane;
        }
    override public function highlight(s:String):Boolean{
        if(content.highlight(s))return true;
        return false;
        }
    override public function gather():DataTree{
        var me:DataTree=DataTree{ name:"ScrollBox" };
        insert content.gather() into me.node("content").children;
        return me;
        }
    }
